﻿using XNAGameEngine.Input;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using XNAGameEngine;
using XNAGameEngine.GameObject;
using XNAGameEngine.Collision;
using XNAGameEngine.Utility;

namespace XNAGameEngine
{
    public class Player_Party : GameObject2D
    {
        private int numOfPartyMembers;
                    //For this small game we set a finite number of party members

        public int NumOfPartyMembers { get { return numOfPartyMembers; } }
                    //Public property for retunring the number of party members in the
                        //players party

        public int[] PartyArray;
                    //Array to hold the party members

        public Player_Party(int partyID) :
            base(partyID)
        {
            Initialize();
        }

        public override void Initialize()
        {
            base.Initialize();
        }

        public void CreateParty(int partyMembers)
        {
            numOfPartyMembers = partyMembers;
            PartyArray = new int[numOfPartyMembers];

            for (int i = 0; i < numOfPartyMembers; i++)
            {
                PartyArray[i] = GameEngine.GetService<IManagerGameObject2D>().CreateGameObject("Warrior");
            }
        }

        public override void Update(GameTime gameTime)
        {
        }

        public void Cleanup()
        {
            GameEngine.GetService<IManagerGameObject2D>().DestroyAllGameObjects();
        }

        public void SetPlayerCharacterStats()
        {
            Warrior tempDude;

            for (int i = 0; i < numOfPartyMembers; i++)
            {
                tempDude = (Warrior)GameEngine.GetService<IManagerGameObject2D>().GetGameObjectById(PartyArray[i]);
                tempDude.normalspeed = MathToolbox.GetRandom.Next(2, 10);
                tempDude.currentspeed = tempDude.normalspeed;
                tempDude.MaxHP = 100;
                tempDude.CurrentHP = tempDude.MaxHP;
                tempDude.AttackPower = MathToolbox.GetRandom.Next(10, 30);
            }
        }
    }
}
